package cn.madis.ymcc.web.controller;

import cn.madis.ymcc.result.JSONResult;
import cn.madis.ymcc.service.ITokenCreatorService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/createToken")
public class TokenCreatorController {
    @Autowired
    private ITokenCreatorService tokenCreatorService;
    /**
     * 生成防止重复Token
     */
    @RequestMapping(value = "/{courseId}",method = RequestMethod.GET)
    public JSONResult get(@PathVariable("courseId")String courseId){
      String token = tokenCreatorService.selectById(courseId);
        return JSONResult.success(token);
    }
}
